<?php

namespace App\Http\Middleware;

use App\Service\WechatService;
use Closure;

class Api
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
//        $wechatService = new WechatService();
//        $token         = $request->input('token', '');
//        $tokenData     = $wechatService->setParams(['token' => $token])->getTokenData();
//        $tokenData['errCode'] && exit($tokenData['errMsg']);
//        $request->offsetSet('mid',$tokenData['data']['mid']);
        $request->offsetSet('mid',2);
        return $next($request);
    }
}
